<template>
  <div class="outer">
    <div class="bubbleItem">
      <span class="bubble rightBubble">
        {{message.msgContent}}
        <span class="bottomLevel"></span>
        <span class="topLevel"></span>
      </span>
    </div>
    <circle-img class="avatar" :src="src" />
  </div>
</template>

<script>
import CircleImg from '../common/CircleImg'

export default {
  name: 'RightBubble',
  components: {
    CircleImg
  },
  props: {
    message: Object,
    src: String
  },
  data () {
    return {
      visible: false
    }
  },
  mounted () {
    this.visible = true
  }
}
</script>

<style lang="stylus" scoped>
.outer {
  margin: 30px 20px 10px 0;
  text-align: right;

  .avatar {
    width: 60px;
    height: 60px;
    display: inline-block;
    vertical-align: bottom;
  }
}

// 气泡样式
.bubbleItem {
  text-align: left;
  display: inline-block;
  margin-bottom: 20px;
}

.bubble {
  float: left;
  max-width: 300px;
  word-wrap: break-word;
  position: relative;
  min-height: 40px;
  line-height: 40px;
  padding: 5px 20px 5px 20px;
  border-radius: 7px;
}

.rightBubble {
  position: relative;
  margin-right: 25px;
  border: 1px solid #d3d5fd;
  background-color: #d3d5fd;
}

.rightBubble .bottomLevel {
  position: absolute;
  bottom: 11px;
  right: -10px;
  border-bottom: 10px solid #d3d5fd;
  border-right: 10px solid transparent;
}

.rightBubble .topLevel {
  position: absolute;
  bottom: 12px;
  right: -8px;
  border-bottom: 10px solid #d3d5fd;
  border-right: 10px solid transparent;
  z-index: 100;
}
</style>
